package com.asistencia.businness;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;

import com.asistencia.dao.interfaces.SemesterDao;
import com.asistencia.domain.Semester;

@Service
public class SemesterBusiness {

	@Autowired
	private SemesterDao semesterDao;

	@Autowired
	private Semester semester;

	public List<Semester> listAll() {
		try {
			semesterDao.listAll();
			List<Semester> lstAll = semesterDao.listAll();
			return lstAll;
		} catch (DataAccessException e) {
			e.printStackTrace();
			return null;
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}

	public Semester getById(Integer idSemester) {
		try {
			semester = semesterDao.getById(idSemester);
			return semester;
		} catch (DataAccessException e) {
			e.printStackTrace();
			return null;
		}

	}
}
